package com.gsafety.library.common;

import android.view.View;

/**
 * 防止抖动的点击事件，防止双击
 */
public abstract class OnUnshakClickListener implements View.OnClickListener
{
    private long lastClickTime = 0;

    @Override
    public void onClick(View view)
    {
        long now = System.currentTimeMillis();
        if (now - lastClickTime >= 500)
        {
            onClick(view, lastClickTime);
            lastClickTime = now;
        }
    }

    public abstract void onClick(View view, long lastClickTime);
}
